#ifndef CHEETAH_GRAPHICS_UTILS_H
#define CHEETAH_GRAPHICS_UTILS_H

#include "cheetah/core/settings.h"
#include "cheetah/core/typedefs.h"
#include "cheetah/geom/aabb.h"
#include "cheetah/model/triangle_mesh.h"

namespace cheetah {
namespace graphics {
using namespace model;
using geom::Point;
class Texture2D;

//class ModelGL {
//  enum PrimType { 
//    kNone = 0x0,
//    kPoints = 0x1,
//    kEdges = 0x2,
//    kTriangles = 0x4,
//    kTrianglesWithAdjacency = 0x8,
//    kAll = 0xf
//  };
//  enum {
//    kWithNormal = 0x1,
//    kWithTexCoord = 0x2
//  };
// public:
//  ModelGL();
//  ~ModelGL();
//  void Initialize(const TriangleMesh *mesh, int opts = kTriangles);
//  void SetData(const TriangleMesh *mesh, const int opts = 0);
//  bool Draw();
//  bool DrawInstanced(const int count);
//  bool DrawWidthAdjacency();
//  void DrawBound();
//private:
//  bool BeginDraw();
//  bool EndDraw();
// private:  
//  uint32 vertex_vbo_;
//  uint32 normal_vbo_;
//  uint32 element_vbo_;
//  const TriangleMesh *mesh_;
//  AABB bound_;
//  int *edge_indices_;
//  int opts_;
//};
void DrawTriangleMesh(const TriangleMesh *mesh);
void DrawQuad(float x1, float y1, float x2, float y2);
void DrawQuad(float x1, float y1, float z1,
              float x2, float y2, float z2,
              float x3, float y3, float z3);
inline void DrawQuad() { DrawQuad(0, 0, 1, 1); }
inline void DrawQuad(float size) {
  DrawQuad(0, 0, size, size);
}
void DrawQuad(float x1, float y1, float x2, float y2, float z);
void DrawCube(const Point &p1, const Point &p2);
void DrawCube(float x1, float y1, float z1,
              float x2, float y2, float z2);
void DrawTextGL(int x, int y, const char *text);
void DisplayStatistics(const char *name, float data, const char *unit,
                       int x = 2, int y = 9);
uint32 MakeFullScreenQuad();
void VisualizeTexture(const Texture2D &tex);
void SaveFrameBuffer(const char *filename);
/*
 * returns ture if error ocurred, otherwise return false
 */
bool CheckErrorsGL(const char *location);

bool CheckGLInfo();
} // graphics
} // cheetah

#endif // CHEETAH_GRAPHICS_UTILS_H
